package cn.itcast.crm.service;

import java.util.List;

import javax.ws.rs.*;

import cn.itcast.crm.domain.Customer;

public interface CustomerService {

	// 查询所有未关联客户列表
	@GET
	@Path("/findNoAssociationCustomers")
	@Produces({"application/xml","application/json"})
	public List<Customer> findNoAssociationCustomers();

	// 已经关联到指定定区的客户列表
	// @PathParam需要指定@Path("/findNoAssociationCustomers/{fixedAreaId}")
	@GET
	@Path("/findHasAssociationCustomers/{fixedAreaId}")
	@Consumes({"application/xml","application/json"})
	@Produces({"application/xml","application/json"})
	public List<Customer> findHasAssociationFixedAreaCustomers(@PathParam("fixedAreaId") String fixedAreaId);

	// 将客户关联到定区上 ， 将所有客户id 拼成字符串 1,2,3，使用@QueryParam实现
	// @QueryParam 不需要指定@Path("/associationCustomersToFixedArea")，在传递多个参数的时候，开发效率高
	@PUT
	@Path("/associationCustomersToFixedArea")
	@Consumes({"application/xml","application/json"})
	public void associationCustomersToFixedArea(@QueryParam("customerIdStr") String customerIdStr, @QueryParam("fixedAreaId") String fixedAreaId);

	// 服务端，用户注册功能
	@Path("/customer")
	@POST
	@Consumes({ "application/xml", "application/json" })
	public void regist(Customer customer);

	//使用电话号码查询唯一的客户对象
	@GET
	@Path("/customer/telephone/{telephone}")
	@Consumes({"application/xml","application/json"})
	@Produces({ "application/xml", "application/json" })
	public Customer findByTelephone (@PathParam("telephone") String telephone);

	//使用电话号码作为条件,更新type为1,表示激活
	@PUT
	@Path("/customer/updatetype/{telephone}")
	@Consumes({"application/xml","application/json"})
	public void updateType(@PathParam("telephone") String telephone);

	// 使用手机账号和密码，查询客户，返回Customer
	@Path("/customer/findByTelephoneAndPassword")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public Customer findByTelephoneAndPassword(@QueryParam("telephone") String telephone,@QueryParam("password") String password);

	// 使用下单地址和客户ID，获取定区ID
	@Path("/customer/findFixedIdByAddressAndCustomerId")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public String findFixedIdByAddressAndCustomerId(@QueryParam("address") String address,@QueryParam("customerId") Integer customerId);
}
